Java four types of references include strong references, soft references, weak references, and virtual references.Strong references:The garbage collector will never recycle as long as the reference existsObject obj = new Object ();
The
Strong references, soft references, weak references, virtual referencesLet's talk about the garbage collection mechanism gabagecollection:GC is the meaning of garbage collection (gabagecollection). Like Java, the Android system is also powered by GC
1. Strong citation (Strongreference) Strong references are the most commonly used references. If an object has a strong reference, the garbage collector will never recycle it. As follows: Object O=new object (); Strong references When there is not
1. Strong, soft, weak, and virtual references to objectsIn previous versions of JDK 1.2, if an object was not referenced by any variable, the program could no longer use the object. That is, only the object is in the accessible (reachable) state
Reprint please the head source link and the tail two-dimensional code together reprint, this article from countercurrent fish yuiop:http://blog.csdn.net/hejjunlin/article/details/52637333Background: Received a public contribution, "Reference from
1. Strong, soft, weak, and virtual references of ObjectsIn versions earlier than JDK 1.2, if an object is not referenced by any variable, the program will no longer be able to use this object. That is, the program can use an object only when it is
Using Java how long has not known the original Java has four types of reference, this reference type and we do not normally say the same. The reference type here does not refer to one of the data types, but refers to the four types that are part of
Today interviewed a company's Java development intern, was asked a question: How to deal with the memory leaks in Java, to ensure that the Java Virtual Machine memory will not be blown out, then actually feel that the interviewer's problem is a bit
The Java 2 platform introduces the java. Lang. Ref package, including classes that allow you to reference objects without leaving them in memory. These classes also provide limited interaction with the garbage collector. Peter Haggar analyzes
strong, soft, weak, and virtual references to objectsin previous versions of JDK 1.2, if an object was not referenced by any variable, the program could no longer use the object. That is, only the object is in the accessible (reachable) state before
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.